package com.example.demo.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * 拦截器
 */
@Configuration
public class WebAppConfig extends WebMvcConfigurerAdapter {
	
//	@Autowired
//	private LoginInterceptor loginInterceptor;
//    @Override
//    public void addInterceptors(InterceptorRegistry registry) {
//    	// 多个拦截器组成一个拦截器链
//        // addPathPatterns 用于添加拦截规则
//        // excludePathPatterns 用户排除拦截
//        registry.addInterceptor(loginInterceptor).addPathPatterns("/manager/*","/catalog/*","/version/*").excludePathPatterns("/manager/toLogin","/manager/login");
//    }
//	/**
//	 * 静态文件路径配置
//	 */
//    @Override
//    public void addResourceHandlers(ResourceHandlerRegistry registry) {
//        registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/");
//    }

//    @Bean
//    public FilterRegistrationBean crosFilter() {
//        CrosFilter crosFilter = new CrosFilter();
//        FilterRegistrationBean registrationBean=new FilterRegistrationBean();
//        registrationBean.setFilter(crosFilter);
//        registrationBean.addInitParameter("WildcardOrigin", "*");
//        registrationBean.setUrlPatterns(Arrays.asList("/*"));
//        registrationBean.setOrder(1);
//        return registrationBean;
//    }
}
